package com.liuning.controller;

import com.liuning.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "hello 控制类")
@RestController
public class HelloController {

    @GetMapping("/hello")
    public String hello() {
        return "hello swagger";
    }

    @PostMapping("/user")
    public User user() {
        return new User();
    }

    @ApiOperation("Hello控制类")
    @GetMapping("/hello2")
    public String hello2(@ApiParam("用户名") String username) {
        return "hello2 " + username;
    }

    @ApiOperation("post测试User")
    @PostMapping("/test")
    public User test(@ApiParam("用户实体") User user) {
        return user;
    }
}
